package com.celesea.workflow.demo.vo;

import com.celesea.framework.dao.TenantFilterAdapter;
import com.celesea.framework.util.CollectionKit;
import com.celesea.framework.util.EnvUtil;
import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author JackYuan
 * @create 2017-11-21 21:43
 */
public class DemoFilter extends TenantFilterAdapter {

    private String userId;

    private List<String> groupIds;

    public DemoFilter() {
        super(EnvUtil.getTenantId());
        this.userId = EnvUtil.getLoginUser().getId();
        if (CollectionKit.isNotEmpty(EnvUtil.getAuthorityUser().getGroups())) {
            this.groupIds = Lists.newArrayList();
            EnvUtil.getAuthorityUser().getGroups().forEach(item -> {
                groupIds.add(item.getId());
            });
        }
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public List<String> getGroupIds() {
        return groupIds;
    }

    public void setGroupIds(List<String> groupIds) {
        this.groupIds = groupIds;
    }
}
